ALL: default
##### User configurable options #####

MPI_CC      = @MPI_CC@
MPI_CLINKER = $(MPI_CC)
#
MPI_CFLAGS  = @MPI_CFLAGS@
MPI_LIBS    = @MPI_LIBS@
CFLAGS      = @CFLAGS@
MPE_GRAPH   = @MPE_GRAPHICS@
MPE_INCDIR  = @includebuild_dir@
MPE_LIBDIR  = @libbuild_dir@
PROF_LIBS   = -L$(MPE_LIBDIR) @PROF_LIBS@ @X_LIB@ $(MPI_LIBS) -lm
#
INCLUDE_DIR = -I$(MPE_INCDIR)
LDFLAGS     = @LDFLAGS@

### End User configurable options ###

RM          = rm

@VPATH@

srcdir         = @srcdir@

# MPE include path, x_INCS, goes in front of MPI include path, MPI_xFLAGS,
# in case MPI include path is in MPI_xFLAGS containing old MPE include path.
MPICC_FLAGS    = $(INCLUDE_DIR) $(MPI_CFLAGS) $(MPE_COPTS)
MPICC_LDFLAGS  = $(LDFLAGS) $(MPI_CFLAGS) $(MPE_LDOPTS)
EXECS          = pmandel@EXEEXT@

.SUFFIXES: .c .@OBJEXT@ @EXEEXT@

.c.@OBJEXT@:
	$(MPI_CC) $(MPICC_FLAGS) -c $<

default: $(EXECS)

fract_gen.@OBJEXT@: fract_gen.h pmandel.h

pm_genproc.@OBJEXT@: pmandel.h fract_gen.h

pmandel.@OBJEXT@: pmandel.h fract_gen.h lists.h pm_genproc.h

pm_separate_rect.@OBJEXT@: pmandel.h pm_genproc.h

pmandel@EXEEXT@: pmandel.@OBJEXT@ pm_genproc.@OBJEXT@ fract_gen.@OBJEXT@ pm_separate_rect.@OBJEXT@ lists.@OBJEXT@ args.@OBJEXT@
	$(MPI_CLINKER) $(MPICC_LDFLAGS) -o $@ $? $(PROF_LIBS)

clean:
	@-$(RM) -f *.@OBJEXT@ *~ PI* $(EXECS) *.log *.out *.ln

distclean: clean
	@-$(RM) -f Makefile

lint:
	lint -chv $(MPE_GRAPH) $(INCLUDE_DIR) $(MPI_CFLAGS) pmandel.c \
	          pm_genproc.c fract_gen.c pm_separate_rect.c lists.c args.c
